package com.jia.lidao.others.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jia.lidao.R;
import com.jia.lidao.others.enity.Order;
import com.squareup.picasso.Picasso;

import butterknife.BindView;

public class OrderGoodView extends AbCustomHeaderView {
    @BindView(R.id.iv_pic)
    ImageView ivPic;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_price)
    TextView tvPrice;
    @BindView(R.id.tv_count)
    TextView tvCount;

    public OrderGoodView(Context context) {
        super(context);
    }

    public OrderGoodView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public OrderGoodView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public int getInflateLayout() {
        return R.layout.order_good_view;
    }

    @Override
    public void setUpView(View view) {

    }

    public void setData(Order.OrdersBean.DataBean.OrderGoodsBean orderGoodsBean){
        Picasso.with(getContext()).load(orderGoodsBean.getGoods_pic()).error(R.drawable.order_merchandiser).into(ivPic);
        tvName.setText(orderGoodsBean.getGoods_name());
        tvPrice.setText("￥"+ String.valueOf(orderGoodsBean.getPrice()));
        tvCount.setText("×"+ String.valueOf(orderGoodsBean.getQuantity()));
    }
}